<script setup>
import HelloWorld from "./components/HelloWorld.vue";
import { https } from "./api/http";
import { onMounted, reactive } from "vue";
import { useRouter, useRoute } from "vue-router";

const router = useRouter();
const route = useRoute();
const testApi = async () => {
  // https
  //   .get("")
  //   .then((res) => {
  //     console.info(res);
  //   })
  //   .catch((error) => {
  //     console.error(error);
  //   });
  const http = await https.get();
  console.log(http);
};
onMounted(() => {
  testApi();
  // 获取浏览器信息
  // console.log(navigator);
});
const btnList = reactive([
  {
    name: "HelloWorld",
    path: "/",
  },
  {
    name: "测试piana",
    path: "/test1",
  },
  {
    name: "test_2",
    path: "/test2",
  },
  {
    name: "测试导入导出表格",
    path: "/importSheet",
  },
  {
    name: "测试串口",
    path: "/SerialPort",
  },
]);
const changePage = (e) => {
  router.push(e);
};
</script>

<template>
  <!-- <div>
    <a href="https://vitejs.dev" target="_blank">
      <img src="/vite.svg" class="logo" alt="Vite logo" />
    </a>
    <a href="https://vuejs.org/" target="_blank">
      <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
    </a>
  </div> -->
  <h1>Vite + Vue</h1>
  <!-- <HelloWorld msg="Vite + Vue" /> -->
  <el-button
    @click="changePage(btn.path)"
    v-for="btn in btnList"
    :key="btn.path"
    type="danger"
    round
    plain
  >
    {{ btn.name }}
  </el-button>
  <router-view></router-view>
</template>

<style scoped>
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
h1 {
  background: linear-gradient(130deg, #24c6dc, #5433ff 41.07%, #ff0099 76.05%);
  /* color: #ffffff; */
  /* background: -webkit-linear-gradient(315deg,#42d392 25%,#647eff); */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 40px;
}
</style>
